<?php

namespace app\admin\controller;

use app\admin\model\User;
use app\common\controller\Backend;
use app\common\model\course\Course;
use app\common\model\QuestionUser;
use think\console\output\Question;

class Dashboard extends Backend
{
    public function initialize(): void
    {
        parent::initialize();
    }

    public function index(): void
    {
        $userTotal = User::count();
        $questionTotal = \app\common\model\QuestionCoupon::count();
        $courseTotal = Course::count();
        $activity = \app\admin\model\Activity::count();
        $questionUserTotal = QuestionUser::group('user_id')->count();

        $this->success('', [
            'userTotal' => $userTotal,
            'questionTotal' => $questionTotal,
            'courseTotal' => $courseTotal,
            'activity' => $activity,
            'questionUserTotal' => $questionUserTotal,
        ]);
    }
}
